{% extends "base.html" %}

{% block head_ex %}
<script type="text/javascript" src="/static/js/jquery.blockUI.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $("#enable_comment").change(function(){
        if($(this).attr('checked')){
            $("#comment_options").show();
            $("#latest_comments_count").focus();
        } else {
            $("#comment_options").hide();
        }
    });
    $("#watermark_enable").change(function(){
        if($(this).attr('checked')){
            $("#watermark_options").show()
            $("#watermark").focus();
        } else {
            $("#watermark_options").hide();
        }
    });
    $("#block_referrers").change(function(){
        if($(this).attr('checked')){
            $("#white_list").show();
            $("#white_list textarea").focus();
        } else {
            $("#white_list").hide();
        }
    });
});              
</script>
{% endblock %}

 
{% block page %}
	<form method="post" id="settings_form">
	<table id="admin_table">
	    <tr>
            <th scope="row">{{ _("Site Title") }}:</th>
            <td><input id="title" name="title" type="text" size="45" value="{{settings.title}}"/>
            </td>
        </tr>
		<tr>
            <th scope="row">{{ _("Site Description") }}:</th>
            <td><input id="description"  name="description" type="text" size="45" value="{{settings.description}}"/>
            </td>
        </tr>
        <tr>
            <th scope="row">{{ _("Albums per page") }}:</th>
            <td><input id="albums_per_page" name="albums_per_page" type="text" size="20" value="{{settings.albums_per_page}}"/>
            </td>
        </tr>
        <tr>
            <th scope="row">{{ _("Thumbs per page") }}:</th>
            <td><input id="thumbs_per_page" name="thumbs_per_page" type="text" size="20" value="{{settings.thumbs_per_page}}"/>
            </td>
       </tr>
       <tr>
            <th scope="row">{{ _("Latest Photos Count") }}:</th>
            <td><input id="latest_photos_count" name="latest_photos_count" type="text" size="20" value="{{settings.latest_photos_count}}"/>
            </td>
       </tr>
       <tr>
            <th scope="row">{{ _("Latest Comments Count") }}:</th>
            <td><input type="checkbox" id="enable_comment" name="enable_comment"
                       {% if settings.enable_comment %}checked{% endif %} />{{ _("Enable Comments") }}
                <br/>
                <div id="comment_options" {% if not settings.enable_comment %}style="display: none;"{% endif %}>
                <input id="latest_comments_count" name="latest_comments_count" type="text" size="20" value="{{settings.latest_comments_count}}"/>
                <br/><input type="checkbox" id="enable_anonymous_comment" name="enable_anonymous_comment"
                           {% if settings.enable_anonymous_comment %}checked{% endif %} />{{ _("Enable Anonymous Comments") }}
                </div>
            </td>
       </tr>
       <tr>
            <th scope="row">{{ _("Max Upload Size") }}(M):</th>
            <td><input id="max_upload_size" name="max_upload_size" type="text" size="20" value="{{settings.max_upload_size}}"/>
            </td>
       </tr>
       <tr>
            <th scope="row">{{ _("Watermark") }}:</th>
            <td>
                <input type="checkbox" id="watermark_enable" name="enable_watermark"
                       {% if settings.enable_watermark %}checked{% endif %} />{{ _("Enable Watermark") }}
                <br/>
                <div id="watermark_options" {% if not settings.enable_watermark %}style="display: none;"{% endif %}>
                    <input id="watermark" name="watermark" type="text" size="18" value="{{ settings.watermark }}"/>
                    {{ _("Font Size") }}:
                    <input id="watermark_size" name="watermark_size" type="text" size="5" value="{{ settings.watermark_size }}"/>px
                    <br/>
                    {{ _("Opacity") }}:
                    <input id="watermark_opacity" name="watermark_opacity" type="text" size="2" value="{{ settings.watermark_opacity }}"/> (0.0 - 1.0)
                    {{ _("Position") }}:
                    <select id="watermark_position" name="watermark_position">
                        {% for pos in watermark_positions %}
                            <option value="{{ pos }}" {% if pos==settings.watermark_position %}selected="true"{% endif %}>
                                {{ _(watermark_positions.get(pos)) }}
                            </option>
                        {% endfor %}
                    </select>
                </div>

            </td>
       </tr>
        <tr>
            <th scope="row">{{ _("Block Hotlinking") }}:</th>
            <td>
                <input type="checkbox" id="block_referrers" name="block_referrers"
                       {% if settings.block_referrers %}checked{% endif %} />{{ _("Enable Block Hotlinking") }}
                <br/>
                <div id="white_list" {% if not settings.block_referrers %}style="display: none;"{% endif %}>
                    {{ _("White List") }}: ({{ _("support Unix style Wildcard") }} ?, *, [abc] or [!abc])<br/>
                    <textarea id="unblock_sites_list" name="unblock_sites_list" wrap="soft"
                              rows="3" cols="25">{{settings.unblock_sites_list|join('\n')}}</textarea>
                    {{ _('one pattern per line') }}
                </div>
            </td>
        </tr>
       <tr>
            <th scope="row">{{ _("Admins") }}:</th>
            <td><textarea id="adminlist" name="adminlist" wrap="soft" rows="3" cols="25">{{settings.adminlist|join('\n')}}</textarea>
                {{ _('one email per line') }}</td>
       </tr>
       <tr>
            <th scope="row"></th>
            <td>
            <input id="save" type="submit" value="{{ _('Save Settings') }}" name="save"/>
            <input id="default" type="submit" value="{{ _('Reset Settings') }}" name="default"/>
            </td>
       </tr>
	</table>
	</form>
	<div id="settings_logo">GAE Photos</div>
	<div style="clear: both;">&nbsp;</div>
{% endblock %}